//用户路由模块
const express = require('express');
//创建路由对象
const routerUsers = express.Router();
//引入用户的处理函数
const expressJoi = require('@escook/express-joi')
const reg_schema = require('../schema/schema')

const handle = require('../router_handler/users')
routerUsers.get('/users', handle.getUsers);
routerUsers.get('/users/:id', handle.search)
routerUsers.put('/users/:uId/state/:type', handle.changeState);
routerUsers.post('/users', expressJoi(reg_schema.user_create_schema), handle.addUsers)
routerUsers.put('/users/:id', expressJoi(reg_schema.user_edit_schema), handle.edit);
routerUsers.delete('/users/:id', handle.delete)
routerUsers.put('/users/:id/role', handle.role)

module.exports = routerUsers